var t = require("../../../@babel/runtime/helpers/defineProperty"), n = getApp();

Page({
    data: {
        esignData: {},
        showPersonBank: !1,
        showCompany: !1,
        showControl: !1,
        changeCompany: !1,
        is_new_add_com: !1,
        controlInfo: {},
        hasCompany: !1,
        cid: 0,
        scene: 1
    },
    onLoad: function(t) {},
    onShow: function() {
        this.init(), this.getData();
    },
    init: function() {
        this.setData({
            scene: this.options.scene,
            hasCompany: !1,
            hasSigning: !1,
            is_new_add_com: !1,
            order_id: this.options.order_id
        });
    },
    getData: function() {
        var t = this, a = n.getNetAddresss("plugin.shop-esign-v2.frontend.controllers.index.index");
        n._postNetWork({
            url: a,
            data: {
                scene_type: this.options.scene,
                cid: this.data.cid,
                order_id: this.options.order_id
            },
            success: function(n) {
                var a = n.data;
                1 == a.result ? (t.setData({
                    esignData: a.data,
                    cid: a.data.cid || 0
                }), t.forSceneList(a.data.scene_list)) : wx.showToast({
                    icon: "none",
                    title: a.msg,
                    duration: 1e3
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    forSceneList: function(t) {
        var n = this;
        t.forEach(function(t) {
            1 == t.sign_type && n.setData({
                hasCompany: !0
            }), t.signed || n.setData({
                hasSigning: !0
            });
        });
    },
    toDecertification: function(n) {
        var a = n.currentTarget.dataset, o = a.status, e = a.val;
        console.log(n), "showCompany" != e || 0 != this.data.esignData.person_status ? Number(o) || this.setData(t({}, e, !0)) : wx.showModal({
            title: "提示",
            showCancel: !1,
            content: "请先完成个人认证",
            success: function(t) {}
        });
    },
    changeCid: function(t) {
        var n = t.detail;
        n.cid && this.setData({
            cid: n.cid,
            is_new_add_com: !1
        }), this.getData();
    },
    addCompany: function() {
        this.setData({
            is_new_add_com: !1,
            showCompany: !0
        });
    },
    toSign: function(t) {
        var n = t.currentTarget.dataset.item;
        0 != this.data.esignData.person_status ? !this.data.hasCompany || this.data.esignData.company_status ? this.setData({
            controlInfo: n,
            showControl: !0
        }) : wx.showModal({
            title: "提示",
            showCancel: !1,
            content: "请先完成企业认证",
            success: function(t) {}
        }) : wx.showModal({
            title: "提示",
            showCancel: !1,
            content: "请先完成个人认证"
        });
    },
    confirmSign: function() {
        this.data.esignData.person_status ? !this.data.hasCompany || this.data.esignData.company_status ? this.data.hasSigning ? wx.showModal({
            title: "提示",
            showCancel: !1,
            content: "请完成合同签署"
        }) : 3 != this.options.scene ? 2 != this.options.scene ? 1 != this.options.scene || wx.redirectTo({
            url: "/packageD/buy/orderPay/orderPay?order_id=".concat(this.options.order_id, "&status=2")
        }) : wx.redirectTo({
            url: "/packageA/member/withdrawal/withdrawal"
        }) : wx.redirectTo({
            url: "/packageB/member/love/love_transfer/love_transfer"
        }) : wx.showModal({
            title: "提示",
            showCancel: !1,
            content: "请先完成企业认证"
        }) : wx.showModal({
            title: "提示",
            showCancel: !1,
            content: "请先完成个人认证"
        });
    },
    onReady: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});